﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Economo.UI.Views;


namespace Economo.UI.Presenters
{
    public abstract class ManageEntitiesPresenter: Presenter<IManageEntitiesView>
    {
        protected ManageEntitiesPresenter(IManageEntitiesView view) : base(view)
        {
            
        }
        #region Event Methods
        public virtual void OnViewLoaded()
        {
            if (base.View!= null)
            {
                View.EntityUpdate+=new EntityUpdateEventHandler(View_EntityUpdate);
                View.EntityDelete += new EntityDeleteEventHandler(View_EntityDelete);
                View.EntityInsert +=new EntityInsertEventHandler(View_EntityInsert);                
            }
        }
        protected virtual void View_EntityUpdate(Int32 rowIndex)
        {
            UpdateEntity(rowIndex);
        }
        protected virtual void View_EntityDelete(object id)
        {
            DeleteEntity(id);
        }
        protected virtual void View_EntityInsert()
        {
            AddNewEntity();
        }
        #endregion
        #region CRUD Methods
        protected virtual void UpdateEntity(Int32 rowIndex)
        {
            throw new NotImplementedException();
        }

        protected virtual void DeleteEntity(object id)
        {
            throw new NotImplementedException();
        }
        protected virtual void AddNewEntity()
        {
            throw new NotImplementedException();
        }

        #endregion
       
        #region FillMethods
        public virtual void FillData()
        {
            throw new NotImplementedException();
        }
        
        #endregion

    }
}
